package cn.fczds.camhelper.complaint.service.impl;

import cn.fczds.camhelper.complaint.mapper.ComplaintMapper;
import cn.fczds.camhelper.complaint.pojo.dto.ComplaintQuery;
import cn.fczds.camhelper.complaint.pojo.dto.ComplaintSaveParam;
import cn.fczds.camhelper.complaint.pojo.entity.Complaint;
import cn.fczds.camhelper.complaint.pojo.vo.ComplaintVO;
import cn.fczds.camhelper.complaint.service.ComplaintService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ComplaintServiceImpl implements ComplaintService {
    @Autowired
    ComplaintMapper complaintMapper;
    @Override
    public List<ComplaintVO> selectByAdminId(ComplaintQuery complaintQuery) {
        List<ComplaintVO> list=complaintMapper.selectByAdminId(complaintQuery);
        return list;
    }

    @Override
    public void add(ComplaintSaveParam complaintSaveParam) {
        Complaint complaint=new Complaint();
        BeanUtils.copyProperties(complaintSaveParam,complaint);
        complaint.setComplaintStatus("审核中");
        complaintMapper.add(complaint);
    }
    @Override
    public void updateComplaintStatus(Long complaintId) {
        complaintMapper.updateComplaintStatus(complaintId);
    }
}
